<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<style>
  .active{
    color:red
  }
</style>
<body>
<!--引入vue-->
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<div id="app">

  <ul>
    <li v-for="(item,index) in movies"
    v-on:click="liClick(index)"
    v-bind:class="{active: activeIndex===index}">{{item}}

    </li>
  </ul>
</div>
<script>
  const app = new Vue({
    el: "#app",
    data:{
      message:"Hello zk I am Vue !",
      movies:["速度与激情","海贼王","盗墓笔记","成龙历险记"],
      activeIndex:-1
    },
    methods:{
      liClick:function (index) {
        this.activeIndex=index;
      }
    }
  })
</script>
</body>
</html>
